<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{/layout/_easyui_Content}" xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
      xmlns:hhm="http://www.w3.org/1999/xhtml">
<head>
    <title>[[${tableTitle}]]</title>
</head>
<body>

<section layout:fragment="content">
    <div data-options="region:'center',border:true">
        <form th:action="@{/zhun/post.do}" method="post" id="editForm" name="editForm"
              style="width:100%;height:100%;">
            <input type="hidden" id="actionGuid" name="actionguid" th:value="${ActionGUID}"/>
            <div class="easyui-tabs" data-options="border:false,fit:true">
                <div title="基本属性" style="padding:16px;">
                    <table class="table">
                        <tr th:if="${model.id != null}">
                            <th class="tdright">
                                ID：
                            </th>
                            <td>
                                [[${model.Id}]]
                                <input type="hidden" name="id" th:value="${model.Id}"/>
                            </td>
                        </tr>
                        <tr>
                            <th class="tdright" width="100">
                                上级栏目：<em>*</em>
                            </th>
                            <td>
                                <input type="text" id="parentId" name="parentId" class="easyui-combotree textbox"
                                       style="width:300px;"
                                       required="true"
                                       th:url="${#servletContext.contextPath + @htmlHelper.actionUrl('parentCombo')}"
                                       th:value="${model.parentId}"/><span
                                    class="ico-Tree"></span>&nbsp;&nbsp;&nbsp;&nbsp;
                                排序：<input type="text" name="sort" class="easyui-numberspinner w60"
                                            required="required" th:value="${model.sort}"/>（由高 -> 低）
                            </td>
                        </tr>
                        <tr>
                            <th class="tdright">
                                栏目标题：<em>*</em>
                            </th>
                            <td>
                                <input type="text" name="title" class="easyui-validatebox textbox w300"
                                       required="required" th:value="${model.title}"/>
                            </td>
                        </tr>
                        <tr>
                            <th class="tdright">
                                状态：<em>*</em>
                            </th>
                            <td>
                                <select id="status" name="status" class="easyui-combobox"
                                        style="width:120px;" required="required"
                                        th:with="listIsStatus=${@dictionary.IsStatus}" th:value="${model.status}">
                                    <!--                                    th:with="listIsStatus=${T(com.kevis.webCommon.tools.ui.Dictionary).IsStatus}">-->
                                    <option th:each="dict:${listIsStatus}" th:text="${dict.getText()}"
                                            th:value="${dict.getValue()}" th:selected="${dict.getValue() == model.status}" ></option>

                                </select>
                            </td>
                        </tr>

                    </table>
                </div>
                <div title="其他" style="padding: 16px;">
                    <table class="table" th:if="${model.id != null}">
                        <tr>
                            <th class="tdright" width="100">
                                创建时间：
                            </th>
                            <td>
                                [[${#temporals.format(model.createTime,'yyyy-MM-dd HH:mm:ss')}]]

                            </td>
                        </tr>
                        <tr>
                            <th class="tdright">
                                更新时间：
                            </th>
                            <td th:text="${#temporals.format(model.updateTime,'yyyy-MM-dd HH:mm:ss')}">

                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </form>
    </div>
    <div class="dialog-button TextCenter" data-options="region:'south',border:false">
        <hhm:roleAction th:attr="actionGuid=${ActionGUID}" actionName="edit"
                        th:if="${model.Id!=null}"></hhm:roleAction>

        <hhm:roleAction th:attr="actionGuid=${ActionGUID}" actionName="add"
                        th:if="${model.Id==null}"></hhm:roleAction>

        <a href="javascript:void(0);" class="easyui-linkbutton " data-options="iconCls:'icon-no'"
           onclick="return window.parent.cancel();">取消</a>

        <!--        <button name="aa" onclick="test1();">测试</button>-->
    </div>
</section>
<scction layout:fragment="JavaScript">
    <script type="text/javascript">
        let addUrl = '[(${@htmlHelper.actionGuid("add")})]';
        let editUrl = '[(${@htmlHelper.actionGuid("edit")})]';
        // var node = $('#parentId').tree('find', 5);
        // $('#parentId').tree('expandTo', node.target);
    </script>
    <script>
        $(function () {
            // 如果希望在点击下拉按钮时自动展开，可以添加以下代码
            // $('#parentId').combotree('panel').panel({
            //     onOpen: function () {
            //         if (node) {
            //             this.combotree('tree').tree('scrollTo', node.target);
            //         }
            //     }
            // });
            $('#parentId').tree({
                onLoadSuccess: function (node) {
                    var t = $(this).combotree('tree');	// get the tree object
                    var n = t.tree('getSelected');
                    t.tree('expandTo', n.target);
                }
            });

        });

        function test1() {
            var t = $('#parentId').combotree('tree');	// get the tree object
            var n = t.tree('getSelected');
            t.tree('expandTo', n.target);

            // var nodes = $('#parentId').tree('find', 4);
            // var parentNode = $('#parentId').tree('getParent', nodes.target);
            // while (parentNode) {
            //     $('#parentId').tree('expandTo', parentNode.target);
            //     parentNode = $('#parentId').tree('getParent', parentNode.target);
            // }
        }
    </script>
    <div th:replace="/layout/partial/easyui/_headClassEdit"></div>
</scction>
</body>
</html>